// Copyright (c) 2012, 2013 All Right Reserved, http://hpc.utp.edu.my
// Author: Nordin Zakaria nordinzakaria@gmail.com
// All rights reserved.


#include <sys/stat.h>
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include <errno.h>
#include "WorkSimulation.h"

#include <vector>
#include <iostream>
#include <fstream>
using namespace std;

#define TOTAL_WORKFORCE		 2000

// Number of WUs we have created 
static int created_wus;
// Number of results we have received so far 
static int processed_wus;
static WorkSimulation worksim;
static int iternum;
static int numiter;


#define W_NUM_PROPERTIES 3
#define W_INFOCAP_INDEX   0
#define W_SAFETY_AW_INDEX 1
#define W_MOTIVATION_INDEX 2


void SimPreStep(WorkSimulation &sim)
	{
	cout << "In Sim PreStep" << endl;
	}

void SimStep(WorkSimulation &sim)
	{
	cout << "In Sim Step" << endl;
	}

void SimPostStep(WorkSimulation &sim)
	{
	cout << "In Sim PostStep" << endl;
	}

void WorkerPreStep(Worker &worker)
	{
	cout << "In Worker PreStep" << endl;
	}

void WorkerStep(Worker &worker)
	{
	cout << "In Worker Step" << endl;
	}

void WorkerPostStep(Worker &worker)
	{
	cout << "In Worker PostStep" << endl;
	}

int main(int argc, char *argv[])
{
	if (argc != 3) {
		cerr << argv[0] << " input output" << endl;
		return -1;
		}

	string infile = argv[1];
	string outfile = argv[2];
        bool hasInput = false;

	Random::init();

	WorkSimulation sim;
	FILE *inputfile = fopen(infile.c_str(), "rb");
	assert(inputfile);
	sim.init(inputfile);
	fclose(inputfile);


	sim.set_Worker_PreStep(WorkerPreStep);
	sim.set_Worker_Step(WorkerStep);
	sim.set_Worker_PostStep(WorkerPostStep);
	sim.set_prestep(SimPreStep);
	sim.set_step(SimStep);
	sim.set_poststep(SimPostStep);

	sim.startSimulation();

	sim.dump(outfile);
}

